1. Field of the Invention
The present invention relates to an electronic camera that generates image data by taking a subject image and stores the image data in a recording medium.
2. Description of the Related Art
Conventionally, electronic cameras are known that perform fixed-length compression (i.e., compression that produces compressed files having approximately constant data amounts) on image data and store the compressed data in a recording medium. Such fixed-length compression has an advantage that the number of remaining frames of the recording medium can be managed correctly and easily.
Incidentally, in such fixed-length compression, to suppress data amounts to approximately constant values, quantization scale enlargement, bit stream cutoff, etc. are performed at the stage of compression processing. In these kinds of processing, part of image information is deleted in such a degree that the deletion is not visually noticeable.
However, particularly for purposes in which high image quality is required (e.g., an image is processed for plate making or an enlarged image is displayed), the deletion of part of image information is problematic.
In view of this, there are some electronic cameras that perform lossless compression on image data and record compressed data. For example, DPCM (differential pulse code modulation) is known as such lossless compression. In the DPCM, differences are taken between pixels adjacent to each other for each of color components (e.g., R, G, and B) and Huffman coding is performed on the resulting difference data.
Further, there are some electronic cameras that perform approximate lossless compression on image data and record the compressed data. Compression in which preprocessing is performed on image data prior to image compression to increase the compression efficiency is known as an example of such approximate lossless compression. Image data loses a slight amount of information during the course of the preprocessing.
Incidentally, above kinds of lossless compression (including approximate lossless compression; this also applies to the following description) are variable-length compression in which the amount of compressed data varies. Therefore, the lossless compression has a problem that the management of the number of remaining frames of a recording medium is difficult.
In particular, there is a problem that when the amount of losslessly compressed data exceeds a remaining capacity by an unexpectedly large amount in a state that the number of remaining frames is equal to “1”, image data obtained by shooting cannot be stored in a recording medium.
In the case of an electronic camera having a rapid shooting buffer memory, the same problem arises even when the number of remaining frames is larger than “1”. At the time of sequential shooting, such an electronic camera stores image data of a plurality of frames in order in the buffer memory. There is a problem that not all of the image data cannot be stored in a recording medium when the total amount of compressed data of the image data stored in the buffer memory exceeds a remaining capacity by an unexpectedly large amount.
In particular, a user's selection of lossless compression means that the shooting is most important to the user. Therefore, in such a case, it is necessary to avoid, to the utmost, an accident that a shooting result cannot be stored.